/*-------------------------------------------------------------------------------
* file:     app_factory.h
* brief:    application
* copyright Copyright (C) 2020-2022 @ NanoIC
* Date:     2023-09-06
* Version:  V1.00
* Author:   JMH
*-------------------------------------------------------------------------------*/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __APP_FACTORY_H__
#define __APP_FACTORY_H__
/* Includes ------------------------------------------------------------------*/
// #include "one_wire_bus_app.h"
#include "app_upgrade.h"
#include "app_key.h" 
#include "common.h" 
#include "sys_console.h"
#include "app_cfg.h"
#include "app_spi.h"
#include "app_lowpower.h"
#include "app_ota_server.h"

extern volatile bool global_factory_enter_on;
extern uint8_t factory_enter_flag;
extern uint8_t uk_flag;
extern volatile uint8_t sn_iQOO_or_V3pro;

/* Private macro-----------------------------------------------------------*/
extern uint8_t button_press_flag;
extern uint8_t key_press_flag;
extern uint16_t send_num;
extern uint16_t receive_pack_num;
extern uint8_t start_send_pack_test_flag;

#define KEY_send_packet_TIMER_N     1000//*100US

#define UART_SEND_STES_SUM     		100

/**
 * @brief 产测标志命令字，加再子数据之前
 */
#define FACTOR_TEST_FLAG_CMD        0x14

#define 	FACTORY_KEY_IO_ENGHT		10
#define     FACTORY_ALL_IO_SHORT_TEST   19

/* Private function--------------------------------------------------------*/
void app_io_input_pull_up(uint8_t pin,uint8_t pull);
void app_io_gpd_pull_up(uint8_t pin,uint8_t pull);
void app_io_out_count(uint8_t pin,uint8_t status);

void app_factory_init(void);
void app_key_control_TR_packet_test(void);
void app_factory_0_1ms_callback(void);
uint8_t one_wire_bus_app_read_acc(uint8_t chose ,uint8_t * temp_buf);
uint8_t one_wire_bus_app_write_acc(uint8_t * p_buf,uint8_t data_len);
#endif



